Ext.define('AmpleHarvest.views.geSearch.searchBox',
		{
			extend			: 'Ext.form.Panel',
			alias			: 'widget.ampleharvest-views-gesearch-searchbox',
			autoHeight		: true,
			frame			: true,
			bodyPadding		: 10,

			initComponent	: function()
			{
				var obj_This = this;
				// TODO - handle passed json
				this.m_obj_TextArea = Ext.create('Ext.form.field.TextArea',
						{
							grow		: true,
							name		: 'general',
							fieldLabel	: 'General',
							anchor		: '100%'
						});

				this.m_obj_submit = Ext.create('Ext.button.Button', 
						{
							text	: 'Submit',
							scope	: this,
							handler	: function() {
								
								var params = new Object();
								params['shards']	= obj_config.C_STR_GE_SOLR_SHARDS;
								params['q']			= this.m_obj_TextArea.getValue();
								params['wt'] 		= 'json';
								params['rows'] 		= '25';
								//TODO : the rows and limit for the time being must be set the same. Find out where the default limit of 25 comes from so they can be changed
								this.next('ampleharvest-objects-results-results').getStore().set_ExtraParams(params);
								this.next('ampleharvest-objects-results-results').getStore().load();
						}
						});
				
				this.items =
				[
					this.m_obj_TextArea,
					this.m_obj_submit
				];
				this.callParent();
			},

			clearField		: function()
			{
				this.m_obj_TextArea.setRawValue();
			},

			get_QueryObject	: function()
			{
				var obj_Output = new Object();
				var obj_Tmp = new Object();

				obj_Output.Query = new Array();

				obj_Tmp.property = "general";
				obj_Tmp.type = "condition";
				obj_Tmp.condition = "==";
				obj_Tmp.join = "AND";
				obj_Tmp.value = Ext.JSON.encode(this.m_obj_TextArea.getValue());

				obj_Output.Query.push(obj_Tmp);

				return obj_Output;
			}

		});